package cn.fulong.smebj.admin.controller;

import cn.fulong.frame.config.Result;
import cn.fulong.smebj.admin.service.LoginService;

import cn.fulong.smebj.entity.User;
import cn.fulong.smebj.mapper.UserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@Api("登录")
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @Autowired
    private UserMapper userMapper;

    @ApiOperation("用户名+密码登录")
    @PostMapping(value = "/login")
    public Result<Object> login(@RequestBody User user) {
        return loginService.login(user);
    }

    @ApiOperation("注册")
    @PostMapping(value = "/register")
    public Result<Object> register(@RequestBody User user) {
        return loginService.register(user);
    }



}
